<?//
//
////设置默认的搜索数据，就是昨天的统计
//
//if(!$_REQUEST['starttime']){$_REQUEST['starttime']=date("Y-m-d",strtotime("-1 day"));}
//if(!$_REQUEST['endtime']){$_REQUEST['endtime']=date("Y-m-d H:i:s");}
//
//
//if(!$_REQUEST['departmentid']){
$_REQUEST['departmentid']=$_SESSION['departmentid'];
//}
//
$department=select_one_line_all_items($table_Prefix."department","nid = '".$_REQUEST['departmentid']."'");
//
// if(($departmentid=="全选")||($departmentid==""))
//{
//    $departmentstr="";
//    $department['name']="全部";
//}
//else{
//    $departmentstr="departmentid = '$departmentid' and";

if(($_SESSION['mid']!="admin")&&($_SESSION['mid']!="finance"))
{
    $departmentstr="departmentid = '".$_SESSION['departmentid']."' and";
}
//}
////;
//
//
//
$departmentid=$_REQUEST['departmentid'];
//
//$starttime=$_REQUEST['starttime'];
//$endtime=$_REQUEST['endtime'];
//
//$starttime=$_REQUEST['starttime']." 00:00:00";
//$endtime=$_REQUEST['endtime']." 23:59:59";
//?>
<!---->
<!---->
<!---->
<!---->
<!---->
<!---->
<!---->
<!---->
<!---->
<!---->
<!--<div class="select-function">-->
<!--    <form action="" method="post">-->
<!---->
<!--        <button class="layui-btn member-info-btn">查询</button>-->
<!---->
<!---->
<!--<input type="hidden" id="department" value="--><?//echo $_REQUEST['department']?><!--" />-->
<!---->
<!--        <div class="layui-form-item" >-->
<!--            <label class="layui-form-label">时间段</label>-->
<!--            <div class="layui-input-block">-->
<!--                <input type="text" name="starttime" id="department-info-starttime" autocomplete="off" class="layui-input"  value="--><?// echo date("Y-m-d",strtotime("-1 day"))?><!--" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" class="laydate-icon">-->
<!--            </div>-->
<!---->
<!--        </div>-->
<!---->
<!---->
<!---->
<!--        <div class="layui-form-item" >-->
<!--            <label class="layui-form-label" style=" width:10px">-</label>-->
<!--            <div class="layui-input-block" style="margin-left:45px; margin-right: 45px;">-->
<!--                <input type="text" name="endtime" id="department-info-endtime" autocomplete="off" class="layui-input "  value="--><?// echo date("Y-m-d") ?><!--" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" class="">-->
<!--            </div>-->
<!--        </div>-->
<!---->
<!---->
<!---->
<!---->
<!--        <br class="clearfloat"/>-->
<!---->
<!--</div>-->






<div class="detail-box statistics-box layui-form">



    <h2>




        <span>当前部门：<? echo $department['name']?></span>
<!--        <span>时间： --><?// echo $_REQUEST['starttime'];?><!-- - --><?// echo $_REQUEST['endtime']; ?><!--</span>-->

    </h2>











    <div class="layui-form">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col>
                <col>
                <col>
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>招生人数</th>
                <th>已付款人数</th>
                <th>未付款人数</th>
                <th>已收学费</th>
                <th>未收学费</th>
                <th>未开收据</th>
                <th>未递交体检表</th>
            </tr>
            </thead>
            <tbody>
            <tr>

                <td><? echo count_by_item($table_Prefix."member",$departmentstr."   departmentid = '$departmentid'");?></td>

                <td><? echo count_by_item($table_Prefix."member",$departmentstr."   status = '已收款' and departmentid = '$departmentid'");?></td>

                <td><? echo count_by_item($table_Prefix."member",$departmentstr."   status = '未收款' and departmentid = '$departmentid'");?></td>

                <td><? echo sum_total($table_Prefix."member","cost",$departmentstr."   status = '已收款' and departmentid = '$departmentid'");?></td>
                <td><? echo sum_total($table_Prefix."member","cost",$departmentstr."   status = '未收款' and departmentid = '$departmentid'");?></td>

                <td> <? echo count_by_item($table_Prefix."member",$departmentstr." receipt != '已生成' ");?></td>

                <td><? echo count_by_item($table_Prefix."member",$departmentstr." healthform != '已提交' ");?></td>

            </tr>

            </tbody>
        </table>
    </div>




<h2>最近七日统计</h2>
    <div class="layui-form">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col>
                <col>
                <col>
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>日期</th>
                <th>招生人数</th>
                <th>收款数目</th>
            </tr>
            </thead>
            <tbody>

            <? for($i=0;$i<7;$i++){?>
                <tr>
                    <td><?echo date("Y-m-d",strtotime("-$i day"))?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m-d",strtotime("-$i day"))."%'  and departmentid = '$departmentid'");?></td>
                    <td><? echo sum_total($table_Prefix."finance","cost",$departmentstr." date like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and classify ='学费收款' ");?></td>
                </tr>
            <?}?>




            </tbody>
        </table>
    </div>










</div>
</div>